package com.spring.sunflower.common

import android.widget.TextView
import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.spring.sunflower.R
import com.spring.sunflower.bean.*
import com.spring.sunflower.util.DateTimeUtils
import java.util.*

/**
 * Created by Kevin on 2021/8/28<br/>
 *
 * Describe:<br/>
 */
class WithdrawRecordAdapter(layoutResId: Int, data: MutableList<WithdrawRecordBean.DatasBean>) :
    BaseQuickAdapter<WithdrawRecordBean.DatasBean, BaseViewHolder>(layoutResId, data) {
    override fun convert(holder: BaseViewHolder, item: WithdrawRecordBean.DatasBean) {
        when (item.status) {
            "0" -> {//待审核
                holder.setText(
                    R.id.tvTitle,
                    "钻石提现(审核中)"
                )
            }
            "1" -> {//已通过
                holder.setText(
                    R.id.tvTitle,
                    "钻石提现(已通过)"
                )
            }
            "2" -> {//拒绝
                holder.setText(
                    R.id.tvTitle,
                    "钻石提现(已拒绝)"
                )
            }
        }
        val timeFormatText = DateTimeUtils.getTimeFormatText(Date((item.createTime).toLong()))
        holder.setText(R.id.tvTime, timeFormatText)
        val tvDetail = holder.getView<TextView>(R.id.tvDetail)
        tvDetail.text = "-${item.amount}"
        tvDetail.setTextColor(ContextCompat.getColor(context, R.color.green))


//        val ivMoney: ImageView = holder.getView(R.id.ivMoney)
//        ivMoney.setImageResource(R.drawable.ic_income_diamond)

    }
}